{extend name="admin@public/base" /}
 
{block name="main-content"}
<div class="page-content">
        <div class="page-header">
                <h1>
                    您当前操作
                    <small>
                        <i class="ace-icon fa fa-angle-double-right"></i>
                        添加模板
                    </small>
                </h1>
            </div>
     <div class="row">
        <div class="col-xs-12">
           <div class="well with-header  with-footer" style="padding-top:50px; zoom:1; overflow:hidden">
             <form class="form-horizontal" name="add_cate" id="add_cate" method="post" action="{:url('add')}">
                        <div class="col-sm-12" >
                        
                        <div class="col-sm-4" style="padding-left:0" >
                        <div class="form-group">
                            <label class="col-sm-3 control-label">选择目录：</label>
                            <div class="input-group col-sm-8">
                              <select name="mbdir" id="mbdir" class="form-control" >
                              {foreach name="jpath" item="jt"}
                                  <option value="{:base64_encode($jt)}">{$jt}</option>
                              {/foreach}
                              </select>
                            </div>
                        </div>
                        </div> 
                        <div class="col-sm-4" >
                        <div class="form-group">
                            <label class="col-sm-5 control-label">模板名称（非中文）：</label>
                            <div class="input-group col-sm-6">
                                 <input id="name" type="text" class="form-control" name="name" value="" placeholder="不需另加后缀,系统自动添加.html" >
                            </div>
                        </div>
                        </div>
                        
                        </div>
                        
                        
                        
                        <div class="col-sm-12" style="border-top:dashed 1px #dedede; padding-top:10px">

                             <div class="col-sm-1" style="text-align: right;padding-right:25px" >
                             <br/><br/><br/>模板内容：
                             </div>
                        
                             <div class="col-sm-9" >
                                <div class="form-group">
                                        <textarea id="content" name="content"></textarea>

                                 
<link rel="stylesheet" href="__PUBLIC__/CodeMirror/codemirror.css">
<link rel="stylesheet" href="__PUBLIC__/CodeMirror/theme/mdn-like.css">
<script type="text/javascript" src="__PUBLIC__/CodeMirror/codemirror.js"></script>
<script type="text/javascript" src="__PUBLIC__/CodeMirror/xml.js"></script>
<script type="text/javascript" src="__PUBLIC__/CodeMirror/javascript.js"></script>

 
<script type="text/javascript">

    var mirror_area = document.getElementById("content");
    var mirror_option = {
        mode: "text/html",
        lineNumbers   :true,//显示行号
        indentUnit    :8,//缩进空格数
        smartIndent   :true,//智能缩进
        theme         :"mdn-like",//主题

        matchBrackets :true,
        gutter        :true,
        fixedGutter   :true,
        indentWithTabs:true,
        readOnly      :false,
        lineWrapping  :true,
        height        :500,
        enterMode     :"keep",
        tabMode       :"shift"
    };
    
    var mirror = CodeMirror.fromTextArea(mirror_area, mirror_option);
    mirror.onChange = function(){
	   $("#content").val(mirror.getValue());
	}
	mirror.refresh();	
$(function(){	    
	$(".ty_tags a").click(function(){
	      var d = $(this).parent().attr('data');
		  var f = $(this).html();
		  f = f.replace('&lt;','<');
		  f = f.replace('&gt;','>');
		  mirror.replaceSelection(f);  
	});	
});
</script>
                               </div>
                             </div>
                        </div>


                        <div class="space-4"></div>

					<div class="clearfix form-actions">
						<div class="col-md-offset-3 col-md-9">
							 
							 
							<button class="btn btn-info" type="submit">
								<i class="ace-icon fa fa-check bigger-110"></i>
								保存
							</button>

							&nbsp; &nbsp; &nbsp;
							<button class="btn" type="reset">
								<i class="ace-icon fa fa-undo bigger-110"></i>
								重置
							</button>
						</div>
					</div>
                    </form>
                
                </div>
            </div>

        </div>
    </div><!-- /.page-content -->


{/block}
{block name="scripts"}
<script language="javascript">
 function do_jedit(id){ 
     edit({w:1024,h:870,title:'编辑模板',url:'./edit/id/'+id+'.html'});
 }
</script> 
{/block}